package com.softer.wxzj.controller;

import com.softer.wxzj.common.aop.annotation.LogRecord;
import com.softer.wxzj.common.aop.enums.LogOperationType;
import com.softer.wxzj.common.aop.enums.LogOperationUnit;
import com.softer.wxzj.common.entity.CommonResult;
import com.softer.wxzj.entity.AccRateCustomInfo;
import com.softer.wxzj.service.AccRateCustomInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @author zcz
 * @date 2019/7/29
 */
@RestController
@RequestMapping("/accRateCustomInfo")
public class AccRateCustomInfoController {
    @Autowired
    private AccRateCustomInfoService accRateCustomInfoService;

    /**
     * 查询设置利率列表
     * @param accRateCustomInfo
     * @return
     */
    @RequestMapping("/getList")
    @LogRecord(description = "查询设置利率列表", operationUnit = LogOperationUnit.ACC_RATE_INFO, operationType = LogOperationType.SELECT)
    public List<AccRateCustomInfo> getList(AccRateCustomInfo accRateCustomInfo) {
        return accRateCustomInfoService.getList(accRateCustomInfo);
    }

    /**
     * 设置利率新增或修改
     * @param accRateCustomInfoList
     * @return
     */
    @PostMapping("/insertOrUpdate")
    @LogRecord(description = "设置利率新增或修改", operationUnit = LogOperationUnit.ACC_RATE_INFO, operationType = LogOperationType.INSERT)
    public CommonResult insertOrUpdate(@RequestBody List<AccRateCustomInfo> accRateCustomInfoList) {
        return accRateCustomInfoService.insertOrUpdate(accRateCustomInfoList);
    }

    /**
     * 删除设置利率
     * @param ids
     * @return
     */
    @PostMapping("/batchDelete")
    @LogRecord(description = "删除利率配置", operationUnit = LogOperationUnit.ACC_RATE_INFO, operationType = LogOperationType.DELETE)
    public CommonResult batchDelete(@RequestParam("ids") String ids) {
        return accRateCustomInfoService.batchDelete(ids);
    }

}
